package com.xiaoma.tpo.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaoma.tpo.dao.ActivityTypeDao;
import com.xiaoma.tpo.domain.ActivityType;

@Service
public class ActivityTypeService {

	@Autowired
	private ActivityTypeDao activityTypeDao;
	
	public List<ActivityType> findAll() {
		return activityTypeDao.findAll();
	}
	
	public List<ActivityType> findAll(Integer pageNum, Integer pageSize) {
		return activityTypeDao.findAll(pageNum, pageSize);
	}
	
	public Integer saveOrUpdate(ActivityType type) {
		if(type.getId() == null) {
			return activityTypeDao.insert(type);
		}else {
			return activityTypeDao.update(type);
		}
	}
	
	public ActivityType findById(Integer id) {
		return activityTypeDao.getById(id);
	}
}
